package com.jian.java;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.stereotype.Service;

import javax.jms.TextMessage;

/**
 * @author Jiange
 * @create 2021-05-28-13:12
 */
@Service
public class SpringProduce {
    @Autowired
    private JmsTemplate jmsTemplate;

    public static void main(String[] args) {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("");
        SpringProduce produce = context.getBean(SpringProduce.class);

        produce.jmsTemplate.send(session -> {
            TextMessage message = session.createTextMessage("建哥最帅");
            return message;
        });
    }
}
